#ifndef LEMC_LEMCOLLECTION_H
#define LEMC_LEMCOLLECTION_H

#include <vector>

#include "lem.h"

class Level;

class LemCollection
{
public:
	std::vector<std::vector<Lem*>> lems;

	void AddPlayer(Level* level, unsigned player_number, unsigned number_of_lems)
	{
		std::vector<Lem*> lem_vector;

		// TODO: Make lem creation conditional based on the player_number - each player should have a different color.
		// That means the graphic has to be adjusted based on the player number.
		for (int unsigned i = 0; i < number_of_lems; i++)
			lem_vector.push_back(new Lem(level, STANDARD_LEM_GRAPHIC));

		lems.push_back(lem_vector);
	};

	void UpdateAll(float timing_factor)
	{
		for (std::vector<std::vector<Lem*>>::iterator player_it = lems.begin(); player_it != lems.end(); player_it++)
		{
			for (std::vector<Lem*>::iterator lem_it = player_it->begin(); lem_it != player_it->end(); lem_it++)
			{
				(*lem_it)->Update(timing_factor);
			}
		}
	}

	void DrawAll()
	{
		for (std::vector<std::vector<Lem*>>::iterator player_it = lems.begin(); player_it != lems.end(); player_it++)
		{
			for (std::vector<Lem*>::iterator lem_it = player_it->begin(); lem_it != player_it->end(); lem_it++)
			{
				(*lem_it)->Draw();
			}
		}
	}
};

#endif